home *** CD-ROM | disk | FTP | other *** search
/ Aminet 6 / Aminet 6 - June 1995.iso / Aminet / gfx / 3d / irit50src.lha / irit5 / prsr_lib / prsr_loc.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-03-08  |  4.1 KB  |  177 lines

  1. /******************************************************************************
  2. * Prsr_loc.h - header file for the data file\s parser library.              *
  3. * This library is closely related to cagd_lib and should be linked with it.   *
  4. *******************************************************************************
  5. * Written by Gershon Elber, Dec. 94.                          *
  6. ******************************************************************************/
  7.  
  8. #ifndef PRSR_LOC_H
  9. #define PRSR_LOC_H
  10.  
  11. #ifdef AMIGA
  12. #ifdef DOUBLE
  13. #undef DOUBLE
  14. #define DOUBLE DOUBLE    /* #ifdef DOUBLE will still work, and */
  15. #endif           /* typedef double DOUBLE in exec/types.h will not fail */
  16. #include <exec/exec.h>
  17. #endif
  18.  
  19. #include <math.h>
  20. #include <stdio.h>
  21. #include "irit_sm.h"
  22. #include "iritprsr.h"
  23.  
  24. #ifdef OS2GCC
  25. #define INCL_DOSPROCESS
  26. #include <os2.h>
  27. #endif /* OS2GCC */
  28.  
  29. #ifdef DOUBLE
  30. #define IP_FLOAT_READ "%lf"
  31. #else
  32. #define IP_FLOAT_READ "%f"
  33. #endif /* DOUBLE */
  34.  
  35. #define UNGET_STACK_SIZE    5             /* Internal stack size. */
  36.  
  37. #define MAX_KNOTS_PER_LINE    5    /* How many knots to print per line. */
  38.  
  39. typedef enum {              /* List of all possible tokens enumerated. */
  40.     IP_TOKEN_NONE,
  41.  
  42.     IP_TOKEN_OPEN_PAREN,
  43.     IP_TOKEN_CLOSE_PAREN,
  44.  
  45.     IP_TOKEN_E1,
  46.     IP_TOKEN_P1,
  47.     IP_TOKEN_E2,
  48.     IP_TOKEN_P2,
  49.     IP_TOKEN_E3,
  50.     IP_TOKEN_P3,
  51.     IP_TOKEN_E4,
  52.     IP_TOKEN_P4,
  53.     IP_TOKEN_E5,
  54.     IP_TOKEN_P5,
  55.  
  56.     IP_TOKEN_NUMBER,
  57.     IP_TOKEN_STRING,
  58.     IP_TOKEN_POINT,
  59.     IP_TOKEN_VECTOR,
  60.     IP_TOKEN_MATRIX,
  61.     IP_TOKEN_CTLPT,
  62.     IP_TOKEN_VERTEX,
  63.     IP_TOKEN_POLYGON,
  64.     IP_TOKEN_POLYLINE,
  65.     IP_TOKEN_POINTLIST,
  66.     IP_TOKEN_OBJECT,
  67.     IP_TOKEN_COLOR,
  68.     IP_TOKEN_RGB,
  69.     IP_TOKEN_INTERNAL,
  70.     IP_TOKEN_NORMAL,
  71.     IP_TOKEN_PLANE,
  72.     IP_TOKEN_CURVE,
  73.     IP_TOKEN_SURFACE,
  74.  
  75.     IP_TOKEN_BEZIER,
  76.     IP_TOKEN_BSPLINE,
  77.     IP_TOKEN_POWER,
  78.     IP_TOKEN_TRIVAR,
  79.     IP_TOKEN_PTYPE,
  80.     IP_TOKEN_NUM_PTS,
  81.     IP_TOKEN_ORDER,
  82.     IP_TOKEN_KV,
  83.     IP_TOKEN_KVP,
  84.     IP_TOKEN_TRIMMDL,
  85.     IP_TOKEN_TRIMSRF,
  86.     IP_TOKEN_TRIMCRV,
  87.     IP_TOKEN_TRIMCRVSEG,
  88.  
  89.     IP_TOKEN_OTHER    = 100,        /* Probably names & numbers. */
  90.     IP_TOKEN_QUOTED,            /* A quoted string. */
  91.  
  92.     IP_TOKEN_EOF = -1
  93. } IPTokenType;
  94.  
  95. #define IP_IS_TOKEN_POINT(Token)  ((Token) >= IP_TOKEN_E1 &&\
  96.                    (Token) <= IP_TOKEN_P5)
  97.  
  98. #define MAX_NUM_OF_STREAMS    20
  99.  
  100. #define SOC_TIME_OUT        1000          /* In 10th of miliseconds. */
  101.  
  102. typedef struct IPStreamInfoStruct {
  103.     int InUse;
  104. #ifdef OS2GCC
  105.     HPIPE pipIrit;
  106. #endif /* OS2GCC */
  107. #if defined(__UNIX__) || defined(__WINNT__)
  108.     int MasterSoc;
  109. #endif /* __UNIX__ || __WINNT__ */
  110.     int IsPipe;
  111. #ifndef AMIGA
  112.     int CommuSoc;
  113. #else
  114.     struct MsgPort *CommuSoc;
  115.     struct MsgPort *ReplySoc;
  116.     int oldpri;
  117. #endif
  118.     int EchoInput;
  119.     FILE *f;
  120.     int IsBinary;
  121.     int TokenStackPtr;
  122.     char TokenStack[UNGET_STACK_SIZE][LINE_LEN];
  123.     int UnGetChar;
  124.     int LineNum;
  125.     int Read;
  126.     int BufferSize;
  127.     int BufferPtr;
  128.     unsigned char Buffer[LINE_LEN_LONG];
  129. } IPStreamInfoStruct;
  130.  
  131. extern IPStreamInfoStruct
  132.     _IPStream[MAX_NUM_OF_STREAMS];
  133.  
  134. extern jmp_buf
  135.     _IritPrsrLongJumpBuffer;
  136. extern int
  137.     _IritPrsrPolyListCirc,
  138.     _IritPrsrReadWriteBinary,
  139.     _IritPrsrGlblParserError,
  140.     _IritPrsrReadOneObject;
  141. extern char
  142.     *_IPGlblFloatFormat;
  143.  
  144. void _IPUnGetToken(int Handler, char *StringToken);
  145. IPTokenType _IPGetToken(int Handler, char *StringToken);
  146. void _IPGetCloseParenToken(int Handler);
  147. int _IPSkipToCloseParenToken(int Handler);
  148. void _IPParserAbort(IritPrsrErrType ErrNum, char *Msg);
  149.  
  150. char *_IPReal2Str(RealType R);
  151.  
  152. char *_IPGetCurveAttributes(int Handler);
  153. char *_IPGetSurfaceAttributes(int Handler);
  154.  
  155. #ifdef USE_VARARGS
  156. void _IPFprintf(int Handler, int Indent, char *va_alist, ...);
  157. #else
  158. void _IPFprintf(int Handler, int Indent, char *Format, ...);
  159. #endif /* USE_VARARGS */
  160.  
  161. #ifdef AMIGA
  162. /* These are the names of two environment variables created and destroyed on
  163.    the fly. They're used to make sure that the server and the client know of
  164.    each other's existence. Yes, I know it's a kludge.
  165. */
  166. #define SERVER_VAR    "IritRunning"
  167. #define CLIENT_VAR    "ClientRunning"
  168.  
  169. struct IritMessage {
  170.   struct Message msg;
  171.   short         nbytes;
  172.   unsigned char     txt[LINE_LEN_LONG];
  173. };
  174. #endif /* AMIGA */
  175.  
  176. #endif /* PRSR_LOC_H */
  177.